home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: netcom.com!marnold
- From: marnold@netcom.com (Matt Arnold)
- Subject: Re: Borland C++: exceptions aren't caught in dynamically loaded DLL (netscape plug-in)
- Message-ID: <marnoldDnxsJL.G7A@netcom.com>
- Organization: NETCOM On-line Communication Services (408 261-4700 guest)
- References: <313F7ED2.5B17@cpsc.ucalgary.ca>
- Date: Fri, 8 Mar 1996 06:54:57 GMT
- Sender: marnold@netcom19.netcom.com
-
- Rob Kremer <kremer@cpsc.ucalgary.ca> writes:
-
- >I've written a Netscape plug-in version of program that works without
- >problem as a stand-alone. Plug-ins are DLLs that are loaded by
- >Netscape when required. (Netscape is written in MS Visual C++, my
- >app is written in Borland C++ v4.52.)
-
- >Whenever an exception is thrown in the plug-in, the plug-in itself
- >can't catch it. It's as though the "try" and "catch" blocks weren't
- >there at all.
-
- >Does anyone have an knowledge about this problem, or, better yet,
- >a solution? (Other than rewriting to avoid exceptions!)
-
- You need to enable "compatible exceptions" in the...
-
- Options|Project|C++ Options|Exception handling/RTTI
-
- ...page. I assume you are creating a 16-bit DLL, as this option only
- applies to 16-bit targets.
-
- Although Borland's on-line help gives a rather vague description of what
- this option actually does, it basically puts a copy of Borland's core
- exception-handling implementation into your DLL. If you do this, your
- DLL's throws an catches should start working.
-
- Where is the exception implementation otherwise? Well, normally, Borland
- DLLs assume they will be linked with Borland EXEs. In the normal scheme,
- many DLLs can share the core exception code in the EXE, reducing wasted
- memory. This also allows exceptions thrown in a Borland DLL to be caught
- in the EXE. Unfortunately, this "nifty" scheme also means that your DLLs
- (at when it comes to C++ exceptions) aren't "compatible" with non-Borland
- EXEs; not to mention that any exception-handling in the DLL doesn't work
- (as you discovered).
-
- Turning on "compatible exceptions" bypasses this whole thing and just
- produces a "self-contained" DLL. Compatible exceptions also implies that
- your DLL should not let exceptions "escape" from any of it's entry-points.
-
- Regards,
- -------------------------------------------------------------------------
- Matt Arnold | | ||| | |||| | | | || ||
- marnold@netcom.com | | ||| | |||| | | | || ||
- Boston, MA | 0 | ||| | |||| | | | || ||
- 617.389.7384 (h) 617.576.2760 (w) | | ||| | |||| | | | || ||
- C++, MIDI, Win32/95 developer | | ||| 4 3 1 0 8 3 || ||
- -------------------------------------------------------------------------
-
-
-